package com.gitee.huxing.course.core.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Description: 全局错误处理
 * @ProjectName: JavaCourse
 * @Package: com.gitee.huxing.course.core.config
 * @ClassName: GlobalExceptionHandler
 * @Author: huxing
 * @DateTime: 2021-09-17 下午5:39
 */
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(RuntimeException.class)
    public String globalExceptionHandler(RuntimeException ex){
        log.info("出现异常错误", ex);
        return "出错了～～～～";
    }
}
